//
//  TBaseViewController.m
//  Tikeyc
//
//  Created by ways on 16/8/15.
//  Copyright © 2016年 tikeyc. All rights reserved.
//

#import "TBaseViewController.h"

@interface TBaseViewController ()






@end

@implementation TBaseViewController

- (void)dealloc
{
    [SVProgressHUD dismiss];
    [TNotificationCenter removeObserver:self];
    [self removeObserverBlocks];
    NSLog(@"%@ 成功销毁了，无内存泄漏",self);
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.edgesForExtendedLayout = UIRectEdgeNone;
//    self.view.backgroundColor = [UIColor whiteColor];

}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Action

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


- (BOOL)prefersStatusBarHidden {
    return NO;
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleDefault;
}

- (UIStatusBarAnimation) preferredStatusBarUpdateAnimation {
    return UIStatusBarAnimationNone;
}

/*
 设置需要更新状态栏。主动调用该方法，将间接调用上述三个方法。如果需要动画生效，需：
 [UIView animateWithDuration:0.4
 animations:^{
 [self setNeedsStatusBarAppearanceUpdate];
 }];
 */
//- (void)setNeedsStatusBarAppearanceUpdate {
//    
//}


- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion{
    [super presentViewController:viewControllerToPresent animated:flag completion:completion];
    
//    if ([viewControllerToPresent isKindOfClass:[UINavigationController class]]) {
//        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
//        if ([viewControllerToPresent isKindOfClass:NSClassFromString(@"TWebViewController")]) {
//            button.titleLabel.font = [UIFont boldSystemFontOfSize:17];
//            [button setTitle:@"返回" forState:UIControlStateNormal];
//            [button sizeToFit];
//            
//            [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//            [button setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
//            
//            button.contentEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
//        }else{
//            button.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
//            
//            button.frame = CGRectMake(0, 0, 44, 44);
//            [button setImage:[UIImage imageNamed:@"common_back_barItem_button"] forState:UIControlStateNormal];
//            
//        }
//        //            @weakify(self);
//        [[button rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
//            //                @strongify(self);
//            [viewControllerToPresent dismissViewControllerAnimated:YES completion:^{
//                
//            }];
//        }];
//        
//        viewControllerToPresent.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
//    }
    
}


@end
